<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //函数返回值注意事项
        //1. return 终止函数
        function getSum(num1,num2) {
            return num1+num2;//return后面的代码不会被执行
            alert('不会被执行弹出的');
        }
        console.log(getSum(1,2));
        //2.return智能返回一个值
        function fn(num1,num2) {
            return num1,num2;
        }
        console.log(fn(1,2));
        // 3.求任意两个数的  加减乘除 结果
        function getResult(num1,num2) {
            return [num1 + num2,num1 - num2,num1 * num2,num1 / num2];
        }
        var re = getResult(1,2);//返回的是一个数组
        alert(re);
        //4.函数有return 返回是return后面的值，没有return 则返回undefined
        function fun1() {
            return 666;
        }
        console.log( fun1());

        function fun2() {
           
        }
        console.log( fun2());
    </script>

</head>
<body>
    
</body>
</html>